//1.代理模式
export { };
interface Star{
  answerPhone(): void;
};
class AngelaBaby implements Star {
  available: boolean = false;
  answerPhone(): void {
    console.log('hello!I am AngelaBaby')
  }
};
class AngelaBabyAgent implements Star {
  angelaBaby: AngelaBaby;
  constructor() {
    this.angelaBaby = new AngelaBaby();
  }
  answerPhone(): void {
    if (this.angelaBaby.available) {
      this.angelaBaby.answerPhone();
    } else {
      console.log('hello!I am AngelaBabyAgent');
    }
  }
};

let angelaBabyAgent = new AngelaBabyAgent();
angelaBabyAgent.answerPhone();